package com.tgd.gbb.uikit.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.v4.view.ViewPager.LayoutParams;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.tgd.gbb.uikit.R;


public class BottomSelectDialog
        extends
        Dialog {

    public interface onSelectSexListener {
        void onSelect(int location);
    }

    private Context context;
    private TextView tvSelect1, tvSelect2, tvCancle;

    private onSelectSexListener listener;

    public BottomSelectDialog(Context context, onSelectSexListener listener) {
        super(context, R.style.common_dialog);
        setCanceledOnTouchOutside(true);

        this.context = context;
        this.listener = listener;
        findViews();

        getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        getWindow().setGravity(Gravity.BOTTOM);
        getWindow().setWindowAnimations(android.R.style.Animation_InputMethod);
    }

    private void findViews() {
        View view = LayoutInflater.from(context).inflate(R.layout.bottom_dialog, null);
        tvSelect1 = (TextView) view.findViewById(R.id.tv_select_one);
        tvSelect2 = (TextView) view.findViewById(R.id.tv_select_two);
        tvCancle = (TextView) view.findViewById(R.id.tv_cancle);
        setContentView(view);
        tvSelect1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onSelect(0);
                dismiss();
            }
        });
        tvSelect2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onSelect(1);
                dismiss();
            }
        });
        tvCancle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }


}


